<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOilPricesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('oil_prices', function (Blueprint $table) {
            $table->id();
            $table->string('city',30)->comment('城市名称');
            $table->unsignedDecimal('ninety_two',6,3)->comment('92号');
            $table->unsignedDecimal('ninety_five',6,3)->comment('95号');
            $table->unsignedDecimal('ninety_eight',6,3)->comment('98号');
            $table->unsignedDecimal('zero',6,3)->comment('0号');
            $table->unsignedBigInteger('created_at')->comment('创建时间');
            $table->unsignedBigInteger('updated_at')->comment('更新时间');
            $table->unsignedBigInteger('deleted_at')->nullable()->comment('删除时间');
            $table->unique(['city','created_at']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('oil_prices');
    }
}
